﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;

namespace ChineseRemainderTheorem.Core
{
    public interface ISecretSharingService
    {
        /// <summary>
        /// Divide a secret
        /// </summary>
        /// <param name="secret">Secret to divide (M)</param>
        /// <param name="usersToRestoreCount">Count of user that together can restore secret (k)</param>
        /// <param name="totalUserCount">Total user count (n)</param>
        /// <returns></returns>
        SecretSharingOperation[] Share(BigInteger secret, int usersToRestoreCount, int totalUserCount);

        Task<SecretSharingOperation[]> ShareAsync(BigInteger secret, int usersToRestoreCount, int totalUserCount);

        /// <summary>
        /// Restore a secret
        /// </summary>
        /// <param name="secrets">parts, to restore a secret</param>
        /// <param name="usersToRestoreCount">Count of user that together can restore secret (k)</param>
        /// <param name="totalUserCount">Total user count (n)</param>
        /// <returns></returns>
        BigInteger Restore(SecretSharingOperation[] secrets, int usersToRestoreCount, int totalUserCount);

        Task<BigInteger> RestoreAsync(SecretSharingOperation[] secrets, int usersToRestoreCount, int totalUserCount);
    }
}
